package servlet;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.JspWriter;

import Model.Processes;

@WebServlet("/ProcedureRecDropDown")
public class ProcedureRecDropDown extends HttpServlet {
	private static final long serialVersionUID = 1L;
    JspWriter out;   
    /**
     * @see HttpServlet#HttpServlet()
     */
    public ProcedureRecDropDown() {
        super();
        // TODO Auto-generated constructor stub
    }
    
    public ProcedureRecDropDown(JspWriter outputStream) {
		// TODO Auto-generated constructor stub
		out = outputStream;
	}
    /**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		
		ArrayList<Processes> ProcedureNames = new ArrayList<Processes>();
		ProcedureNames = Database.ProcessesDB.GetProcedureLatest();
		
		for(int i = 0; i < ProcedureNames.size(); i++)
		{
			System.out.println("<option value='" + ProcedureNames.get(i).getId() + "'>");
			out.print("<option value='" + ProcedureNames.get(i).getId() + "'>");
				out.print(ProcedureNames.get(i).getProcedureName());
			out.print("</option>");
		}
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		
		
	}
}